<div class="pro_search_top">
  <h1><?php echo $heading_title; ?></h1>
</div>
<div class="pro_search_middle"><b>
<div id="content_search">
    <table>
      <tr>
        <td><?php echo $entry_search; ?></td>
        <td><?php if ($keyword) { ?>
          <input type="text"  name="keyword" value="<?php echo $keyword; ?>" id="keyword" />
          <?php } else { ?>
          <input type="text" onFocus="this.value=''" name="keyword" value="<?php echo $text_keywords; ?>" id="keyword" />
          <?php } ?></td>
      </tr>
      <tr>
        <td colspan="2"><?php if ($description) { ?>
          <input type="checkbox" name="description" id="description" checked="checked" />
          <?php } else { ?>
          <input type="checkbox" name="description" id="description" />
          <?php } ?>
          <?php echo $entry_description; ?></td>
      </tr>
    </table>
  </div>
  <div class="buttons">
    <table>
        <td align="right"><a onclick="contentSearch();" class="button"><span><?php echo $button_search; ?></span></a></td>
      <tr>
      </tr>
    </table>
  </div>
  <div class="heading">Kết quả tìm kiếm</div>
  <?php if (isset($products)) { ?>
  <div class="sort">
    <div class="div1">
      <select name="sort" onchange="location=this.value">
        <?php foreach ($sorts as $sorts) { ?>
        <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
        <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
        <?php } else { ?>
        <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
        <?php } ?>
        <?php } ?>
      </select>
    </div>

    <div class="div2"><?php echo $text_sort; ?></div>
  </div>
  <div id="category_product_suggestion" name="product_suggestion">
            <ul>
                <?php for ($i = 0; $i < sizeof($products); $i++) { ?>
                    <li class="category_bg_grays">
                        <div class="category_image-view"> <!--Hinh anh san pham-->
                            <a href="<?php echo $products[$i]['href']; ?>">
                                <img width="80px" hight="80px" src="<?php echo $products[$i]['thumb']; ?>" alt="<?php echo $products[$i]['name']; ?>"/>
                            </a>
                        </div>
                        <h1 class="pro_name"> <!--Tieu de san pham-->
                            <a href="<?php echo $products[$i]['href']; ?>">
                                <!-- Chen tieu de sp -->
                                <?php echo $products[$i]['name']; ?>
                            </a>
                        </h1>
                        <p class="pro_value">
                            <?php if ($display_price) { ?>
                                Giá:
                                <?php if (!$products[$i]['special']) { ?>
                                    <span class="pro_price"> <?php echo $products[$i]['price']; ?></span>
                                <?php } else { ?>
                                    <span class="pro_price"> <?php echo $products[$i]['price']; ?></span> <?php echo $products[$i]['special']; ?>
                                <?php } ?>
                            <?php } ?>
                        </p>
                        <p class="pro_place">
                            Bán bởi 
                            <?php if (isset($products[$i]['shop_name'])) { ?>
                                <span class="pro_user"> <?php echo $products[$i]['shop_name'] ?></span>
                            <?php } ?> tại <span class="pro_place"><?php echo $products[$i]['zone']; ?></span>
                        </p>
                    </li>
                <?php } ?>  
            </ul>
            </div>
  <?php if ($products) { ?>
  <div class="pagination"><?php echo $pagination; ?></div>
  <?php } ?>
</div>
<?php } else { ?>
<div style="clear: both; height:23px;background-color:#F6F9FF;">
	Không tìm thấy sản phẩm nào.
</div>
<?php } ?>
<style type="text/css">
	.catalog {
		border:1px solid #77b7ff;
	}
	.catalog td {
		border-bottom:1px solid #77b7ff;
		border-left: 1px solid #abdcff;
		border-right: 1px solid #abdcff;
		text-align: left;
		margin-top: 2px;
		padding-left: 10px;
	}
	.catalog tr td h1 {
		color: blue;
		margin-top: 1px;
		font-weight: lighter;
	}

	.catalog tr td h1 a {
		color:blue;
		margin-top: 1px;
		font-weight: lighter;
		font-size:11;
		text-decoration: none;
	}
</style>
<script type="text/javascript">
$('#content_search input').keydown(function(e) {
	if (e.keyCode == 13) {
		contentSearch();
	}
});
function contentSearch() {
	url = 'index.php?route=product/search';
	var keyword = $('#keyword').attr('value');
	if (keyword) {
		url += '&keyword=' + encodeURIComponent(keyword);
	}
	if ($('#description').attr('checked')) {
		url += '&description=1';
	}
	location = url;
}
</script>
